package perform.event;

import java.lang.reflect.Field;

import perform.annotations.ManyToMany;
import perform.annotations.ManyToOne;
import perform.annotations.OneToMany;
import perform.type.Type;

public class LoadEvent extends PerformEvent {

	protected LoadType loadType;
	
	public LoadEvent(Type source, Field sourceField) {
		super(source, sourceField);
		if(sourceField.isAnnotationPresent(ManyToMany.class)){
			loadType = LoadType.LOAD_M2M;
		} else if(sourceField.isAnnotationPresent(ManyToOne.class)){
			loadType = LoadType.LOAD_M2O;
		} else if(sourceField.isAnnotationPresent(OneToMany.class)){
			loadType = LoadType.LOAD_O2M;
		} else {
			loadType = LoadType.LOAD_O2O;
		}
	}
	public LoadType getLoadType() {
		return loadType;
	}

	enum LoadType {
		
		LOAD_M2M,
		LOAD_M2O,
		LOAD_O2M,
		LOAD_O2O
		
	}

}
